﻿window.onload = function () {
    if (action == "insert") {//添加
        //获取当前用户的UserID
        var url = encodeURI("../../Crm/BSendSysNews.ashx?num=getUsers&ID=wolf&r=" + Math.random());
        $.get(url, function (d, s) {
            //a.substring(0,a.indexOf("|"))+"   "+a.substring(a.indexOf("|")+1,a.lastIndexOf("|"))+"   "+a.substring(a.lastIndexOf("|")+1)
            var UserID = d.substring(0, d.indexOf("|"));
            var time = d.substring(d.indexOf("|") + 1, d.lastIndexOf("|"));
            var empName = d.substring(d.lastIndexOf("|") + 1);

            var recordID = window.parent.myDataTable.getSelectedRows()[0];
            record = window.parent.myDataTable.getRecord(recordID);
            $("#CstID").val(record._oData.ID);
            $("#AddUser").val(UserID);
            $("#AddTime").val(time);
        });
    }

}

var fnCheckData = function () {
    try {
        if ($("#Lkm_name").val() == "") {
            alert("联系人姓名不能为空！");
            return;
        } else if ($("#Lkm_tel").val() == "" && $("#Lkm_mobile").val() == "") {
            alert("号码不能全部为空！");
            return;
        }
    }
    catch (e)
     { alert(e.ToString()); }
}